import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    // 登录注册页面
    {
      path: '/login',
      component: () => import('@/views/Login/LoginPage.vue')
    },
    
    // 主布局
    {
      path: '/',
      component: () => import('@/views/layout/index.vue'),
      redirect: '/home',
      children: [
        // 首页
        {
          path: '/home',
          component: () => import('@/views/home/Home.vue')
        },
        // 老人信息
        {
          path: '/elderly',
          component: () => import('@/views/elderly/ElderlyInfo.vue')
        },
        // 预约记录
        {
          path: '/appointment',
          component: () => import('@/views/appointment/AppointmentList.vue')
        },
        // 账单管理
        {
          path: '/finance',
          component: () => import('@/views/finance/BillList.vue')
        },
        // 个人设置
        {
          path: '/settings',
          component: () => import('@/views/settings/Profile.vue')
        }
      ]
    },

    // 老人信息相关页面
    {
      path: '/elderly/health',
      component: () => import('@/views/elderly/HealthData.vue')
    },
    {
      path: '/elderly/medication',
      component: () => import('@/views/elderly/MedicationInfo.vue')
    },
    {
      path: '/elderly/care',
      component: () => import('@/views/elderly/CareRecord.vue')
    },
    {
      path: '/elderly/bind',
      component: () => import('@/views/elderly/Binding.vue')
    },

    // 预约相关页面
    {
      path: '/appointment/list',
      name:'AppointmentList',
      component: () => import('@/views/appointment/AppointmentList.vue')
    },

    // 财务相关页面
    {
      path: '/finance/bill/:id',
      name: 'BillDetail',
      component: () => import('@/views/finance/BillDetail.vue')
    },
    {
      path: '/finance/payment/:billId',
      name: 'Payment',
      component: () => import('@/views/finance/Payment.vue')
    },

    // 反馈相关页面
    {
      path: '/feedback',
      component: () => import('@/views/feedback/FeedbackList.vue')
    },
    {
      path: '/feedback/new',
      component: () => import('@/views/feedback/FeedbackForm.vue')
    },

    // 设置相关页面
    {
      path: '/settings/notification',
      component: () => import('@/views/settings/Notification.vue')
    },
    {
      path: '/settings/help',
      component: () => import('@/views/settings/Help.vue')
    }
  ]
})

// 导航栏配置
export const navConfig = [
  {
    index: 0,
    name: '首页',
    icon: 'home-o',
    route: '/home'
  },
  {
    index: 1,
    name: '老人信息',
    icon: 'user-o',
    route: '/elderly'
  },
  {
    index: 2,
    name: '预约',
    icon: 'calendar-o',
    route: '/appointment'
  },
  {
    index: 3,
    name: '账单',
    icon: 'bill-o',
    route: '/finance'
  },
  {
    index: 4,
    name: '设置',
    icon: 'setting-o',
    route: '/settings'
  }
]


export default router